<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Basic DateTimeBox - jQuery EasyUI Demo</title>
	<link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../../jquery.min.js"></script>
	<script type="text/javascript" src="../../jquery.easyui.min.js"></script>
</head>
<body>
	<h2>Basic DateTimeBox</h2>
	<div class="demo-info">
		<div class="demo-tip icon-tip"></div>
		<div>Click the calendar image on the right side.</div>
	</div>
	<div style="margin:10px 0;"></div>
	<input class="easyui-datetimebox" required style="width:150px" data-options="showSeconds:true">
</body>
<script>
	$.fn.datetimebox.defaults.formatter = function(date){
        if (!date){return '';}
		var yyyy = date.getFullYear();
        var MM = formatN(date.getMonth()+1);
        var dd = formatN(date.getDate());

		var HH = formatN(date.getHours());
		var mm = formatN(date.getMinutes());
		var ss = formatN(date.getSeconds());
		return yyyy+'-'+MM+'-'+dd+' '+HH+':'+mm+':'+ss;		

        function formatN(value){
            return (value < 10 ? '0' : '') + value;
        }
    }


    $.fn.datebox.defaults.formatter = function(date){
        if (!date){return '';}
		var yyyy = date.getFullYear();
        var MM = formatN(date.getMonth()+1);
        var dd = formatN(date.getDate());
		return yyyy+'-'+MM+'-'+dd;	
    }
</script>
</html>